import * as Cesium from  "cesium"
const profileAnalysis = function(viewer){
    this.viewer = viewer
}
profileAnalysis.prototype = {
    //根据起始点插值
    interpolation:function(cartesianStart,count){
        var cartesians = new Array(count);
        for (var i = 0; i < count; ++i) {
            var offset = i / (count - 1);
            cartesians[i] = Cesium.Cartesian3.lerp(
            cartesianStart,
            cartesianEnd,
            offset,
            new Cesium.Cartesian3()
            );
        }
        return cartesians
    },
    //计算高度
    calculationHeight:function(cartesians,objectsToExclude){
        var promise = this.viewer.scene.clampToHeightMostDetailed(cartesians,objectsToExclude)
        promise.then(function(updatedCartesians) {
            entities[0].position = updatedCartesians[0];
            entities[1].position = updatedCartesians[1];
        })
    }
}
export default profileAnalysis